﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domaine.Entity;

namespace Infrastructure.Data.Context.UnitOfWork.Mapping
{
    public class UserMapper : EntityTypeConfiguration<User>
    {

        public UserMapper()
        {
            this.HasMany(m=>m.Roles).
              WithMany(p => p.Users).
              Map(
               m =>
               {
                   m.MapLeftKey("UserID");
                   m.MapRightKey("RoleID");
                   m.ToTable("UsersInRoles");
               });
            
        }
    }
}
